<?php

APP::import('Helper' ,'Html');
class UsersController extends AppController 
{
	var $name = 'Users';
	
//	var $scaffold;
	function login()
	{
		if (!empty($this->data ))
		{
			if ($this->User->checkLogin($this->data['User']['username'] ,$$this->data['User']['password'])){
				$this->redirect( HtmlHelper::url( array('controller'=>'users','action' =>'index')));
			} else {
				$this->Session->setFlash('用户名或密码错误');
			}
		}
	}
	
	function signup()
	{
		if (!empty($this->data))
		{
			$this->data['User']['group_id'] = 0;
			$this->User->save($this->data);
			$this->redirect( HtmlHelper::url( array('controller'=>'users' ,'action'=>'index')));
		}
	}
	
	function index()
	{
		$this->set('');
	}
}
?>